function Range(from, to) {
  this.from = from;
  this.to = to;
}
Range.prototype = {
  includes: function (x) {
    return this.from <= x && x <= this.to;
  },
  [Symbol.iterator]: function* () {
    for (let x = Math.ceil(this.from); x <= this.to; x += 1) yield x;
  },
  toString: function () {
    return "(" + this.from + "..." + this.to + ")";
  },
};
let r = new Range(1, 3);
console.log(r.includes(2)); // true
console.log(r.toString()); // (1...3)
console.log([...r]); // [1,2,3]
console.log(r instanceof Range); // true
// console.log(r.constructor === Range);

function Strange() {}
Strange.prototype = Range.prototype;
const strange = new Strange();
console.log(strange instanceof Range); // true
console.log(Range.prototype.isPrototypeOf(strange));
